package com.example.jeong.yuejian10.Activity;

import android.app.Activity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.ImageView;

import com.example.jeong.yuejian10.Adapter.ClubActAdapter;
import com.example.jeong.yuejian10.Bean.ActivityBean;
import com.example.jeong.yuejian10.Listener.RetrofitListener;
import com.example.jeong.yuejian10.Model.ClubModel;
import com.example.jeong.yuejian10.R;

import java.util.List;

//俱乐部详情 的所有活动页
public class ClubActActivity extends Activity implements View.OnClickListener,RetrofitListener<List<ActivityBean>> {
    private ImageView left;
    private RecyclerView recyclerView;
    private ClubActAdapter adapter;

    @Override
    public void onCreate(Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_club_act);
        initView();
        initEvent();
        getClubactivitys();

    }

    private void initView() {
        recyclerView = (RecyclerView) findViewById(R.id.club_activity);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));//设置布局
        left = (ImageView) findViewById(R.id.left);

    }

    private void initEvent() {
        //返回上一页
        left.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });


    }
    void getClubactivitys(){
        Bundle bundle = this.getIntent().getExtras();
        int c_id = bundle.getInt("c_id");
        ClubModel clubModel=new ClubModel();
        clubModel.getClubactivitys(c_id,this);
    }

    @Override
    public void onSuccess(List<ActivityBean> activityBeen){
        adapter = new ClubActAdapter(ClubActActivity.this,activityBeen);
        recyclerView.setAdapter(adapter);
    }

    @Override
    public void onFail() {
        //showToast("网络发生错误");
    }
    @Override
    public void onClick(View view) {



        

    }

}
